home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _GOTOXY.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  59 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__gotoxy = "$Header: c:/curses/private/RCS/_gotoxy.c%v 2.0 1992/11/15 03:24:27 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_gotoxy() - position hardware cursor at (x, y)
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses routine.
  17.  
  18.        Moves the physical cursor to the desired address on the
  19.        screen. We don't optimize here -- on a PC, it takes more time
  20.        to optimize than to do things directly.
  21.  
  22.   PDCurses Return Value:
  23.        This function returns OK on success and ERR on error.
  24.  
  25.   PDCurses Errors:
  26.        No errors are defined for this function.
  27.  
  28.   Portability:
  29.        PDCurses        int PDC_gotoxy( int row, int col );
  30.  
  31. **man-end**********************************************************************/
  32.  
  33. int    PDC_gotoxy(int row, int col)
  34. {
  35.        if ((_cursvar.cursrow == row) && (_cursvar.curscol == col))
  36.                return( OK );
  37.  
  38. #ifdef FLEXOS
  39.        retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  40.        if (retcode < 0L)
  41.                return( ERR );
  42.        vir.vc_cursor.pos_row = row;
  43.        vir.vc_cursor.pos_col = col;
  44.        retcode = s_set(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  45.        return( (retcode < 0L) ? ERR : OK );
  46. #endif
  47. #ifdef DOS
  48.        regs.h.ah = 0x02;
  49.        regs.h.bh = _cursvar.video_page;
  50.        regs.h.dh = (unsigned char) row;
  51.        regs.h.dl = (unsigned char) col;
  52.        int86(0x10, ®s, ®s);
  53.        return( OK );
  54. #endif
  55. #ifdef OS2
  56.        VioSetCurPos (row, col, 0);
  57. #endif
  58. }
  59.